# $Id: PKGBUILD 88603 2013-04-20 16:32:48Z jlichtblau $
# Maintainer: Jaroslav Lichtblau <dragonlord@aur.archlinux.org>
# Contributor: Michele Schäuble <mschaeuble@swissonline.ch>

pkgname=josm
pkgver=5836
pkgrel=1
pkgdesc="An editor for OpenStreetMap written in Java"
arch=('any')
url="http://josm.openstreetmap.de/"
license=('GPL')
depends=('java-runtime')
changelog=$pkgname.changelog
backup=('etc/conf.d/josm')
source=(http://josm.openstreetmap.de/$pkgname-tested.jar \
        $pkgname.desktop \
        $pkgname.conf.d)
sha256sums=('aa0738b985b0618305c06086e7a62d72fa331fa8f2592068cbcec9a825932786'
            'edfb2cbf2aa7e6582b4d43cd402ea58be7990702e5ffffc3ff7afdc518c28ca9'
            'c86a73251eed42fcb129ae9b88a0ee3cf03d8d00a9385519ad536d5af0907663')

package() {
  cd ${srcdir}
  
  install -D -m644 $pkgname-tested.jar ${pkgdir}/usr/share/java/$pkgname/$pkgname.jar

#.desktop and icon file
  install -D -m644 ${srcdir}/${pkgname}.desktop ${pkgdir}/usr/share/applications/$pkgname.desktop
  install -D -m644 images/logo.png ${pkgdir}/usr/share/pixmaps/$pkgname.png

#executable file
  install -d ${pkgdir}/usr/bin
  cat <<"EOF" >${pkgdir}/usr/bin/$pkgname 
#!/bin/sh
# source application-specific settings
JOSM_ARGS=
[ -f /etc/conf.d/josm ] && . /etc/conf.d/josm
CLASSPATH="/usr/share/java/josm/josm.jar"
java ${JOSM_ARGS} -cp "${CLASSPATH}" org.openstreetmap.josm.gui.MainApplication "$@" 
EOF
  chmod 755 ${pkgdir}/usr/bin/$pkgname
  install -Dm644 ${srcdir}/$pkgname.conf.d ${pkgdir}/etc/conf.d/$pkgname
}
